using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace Services
{
	/// <summary>
	/// Enum of every font present in the game.
	/// </summary>
	public enum FontType
	{
		Delicious13,
		Delicious26,
		Delicious26Bold,
		Delicious36,
		Delicious48,
		DeliciousSmallCaps22,
		DeliciousSmallCaps28
	}

	/// <summary>
	/// Service that load and store fonts for the game
	/// </summary>
	public class FontLibrary
	{

		protected Dictionary<FontType, SpriteFont> fonts;
		private ContentManager content;

		public FontLibrary(ContentManager content)
		{
			fonts = new Dictionary<FontType, SpriteFont>();
			this.content = content;
		}

		public void LoadContent()
		{
			LoadSingleFont(FontType.Delicious13, "button_small"); 
			LoadSingleFont(FontType.Delicious26, "credits");
			LoadSingleFont(FontType.Delicious36, "end_page");
			LoadSingleFont(FontType.Delicious48, "header");
			LoadSingleFont(FontType.DeliciousSmallCaps28, "high_score");
			LoadSingleFont(FontType.Delicious26Bold, "main");
			LoadSingleFont(FontType.DeliciousSmallCaps22, "timer");
		}

		private void LoadSingleFont(FontType font, String name)
		{
			fonts.Add(font, content.Load<SpriteFont>("Graphics/Font/" + name));
		}

		public bool FontExists(FontType name)
		{
			return fonts.ContainsKey(name);
		}

		public SpriteFont Font(FontType name)
		{
			return fonts[name];
		}
	}
}
